package com.itheima.homework06;

import java.time.LocalDate;
import java.time.Period;
import java.time.format.DateTimeFormatter;
import java.util.Scanner;

public class Test03 {
    public static void main(String[] args) {
        //创建键盘录入对象
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入您的生日，格式：yyyy-MM-dd");
        String birthday = sc.next();
        DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd");
        LocalDate ld = LocalDate.parse(birthday,dtf);
        System.out.println(ld);
        //当前时间
        LocalDate now = LocalDate.now();
        Period period = Period.between(ld,now);
        int year = period.getYears();
        int month = period.getMonths();
        int day = period.getDays();
        System.out.println("您已经活了："+year+"年零"+month+"月零"+day+"天了！");
    }
}
